﻿#region using
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

using XmlGenSharp.Logic.Main.Configuration;
#endregion

namespace XmlGenSharp.Logic.Main
{
  public class GeneratorContext : IGeneratorContext
  {
    // Constructors

    #region GeneratorContext(IGenerator generator, Config config, TextWriter writer)
    public GeneratorContext(IGenerator generator, Config config, TextWriter writer)
    {
      Generator = generator;
      Writer = writer;
      Config = config;
    }
    #endregion

    // Public Properties

    #region Generator
    public IGenerator Generator
    {
      get;
      protected set;
    }
    #endregion

    #region Writer
    public TextWriter Writer
    {
      get;
      protected set;
    }
    #endregion

    #region Config
    public Config Config
    {
      get;
      set;
    }
    #endregion

    // Public Methods

    #region W(string fmt, params object[] args)
    public void W(string fmt, params object[] args)
    {
      if (args.Length == 0)
        Writer.Write(fmt);
      else
        Writer.Write(fmt, args);
    }
    #endregion

    #region WL(string fmt, params object[] args)
    public void WL(string fmt, params object[] args)
    {
      if (args.Length == 0)
        Writer.WriteLine(fmt);
      else
        Writer.WriteLine(fmt, args);
    }
    #endregion
  }
}
